import request from './request'
import consts from './consts'

function get(url, params) {
  // headers: {token: utils.cookie.get('UMICODE') || ''}
  return request({ url, method: 'get', params })
}
function post(url, data) {
  return request({ url, method: 'post', data })
}
/** --------------------------------首页 接口-------------------------------- */

/**
 * 账号密码登陆
 */
export const login = params => post('/client/auth/login', params)
/**
 * 用户信息查询
 */
export const getUser = params => post('/client/user/info/search', params)

/**
 * 用户信息查询
 */
export const getInfo = params => get('/client/user/info/search', params, true)

/** -----------------------------------------------access   授权相关------------------------------------------------ */
/**
 * /gzh/{appId}/sign 获取微信URL的签名
 */
export const authSign = params => get(`/access/gzh/${consts.appId}/sign`, params, true)

/**
 * aliyun/storage/url/auth 阿里云url授权
 */
export const aliyunAuth = params => get(`/access/aliyun/storage/auth`, params, true)

/**
 * /aliyun/storage/auth/sts 通过RAM授权
 */
export const aliyunSTSAuth = params => get(`/access/aliyun/storage/auth/sts`, params, true)

